import React, { Component } from 'react';
import BScroll from 'better-scroll';

export default class App extends Component {
  state = {
      list:[]
  }
  getList(){
      var datalist = ['111','222','333','444','555','111','222','333','444','555','111','222','333','444','555'];
      this.setState({
          list:datalist
      },()=>{
        new BScroll('.wrapper');
      })
  }
  render() {
    return (
        <div>
            <button onClick={()=>this.getList()}>click</button>
            <div className="wrapper" style={{height:'200px',backgroundColor:'red', overflow:'hidden'}}> 
                <ul className="content"> 
                    {
                        this.state.list.map(item =>
                            <li key={item}>{item}</li>
                        )
                    }
                </ul>
            </div>
        </div>
    )
  }
}
